package cn.iocoder.yudao.module.ai.controller.admin.operationreceivemessage;

import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;

import cn.iocoder.yudao.module.ai.controller.admin.operationreceivemessage.vo.*;
import cn.iocoder.yudao.module.ai.dal.dataobject.operationreceivemessage.OperationReceiveMessageDO;
import cn.iocoder.yudao.module.ai.service.operationreceivemessage.OperationReceiveMessageService;

@Tag(name = "管理后台 - 终端推送消息日志")
@RestController
@RequestMapping("/ai/operation-receive-message")
@Validated
public class OperationReceiveMessageController {

    @Resource
    private OperationReceiveMessageService operationReceiveMessageService;

//    @PostMapping("/create")
//    @Operation(summary = "创建终端推送消息日志")
//    @PreAuthorize("@ss.hasPermission('ai:operation-receive-message:create')")
//    public CommonResult<Long> createOperationReceiveMessage(@Valid @RequestBody OperationReceiveMessageSaveReqVO createReqVO) {
//        return success(operationReceiveMessageService.createOperationReceiveMessage(createReqVO));
//    }

    @PostMapping("/report")
    @Operation(summary = "终端推送消息上报")
    public CommonResult<Long> report(@Valid @RequestBody OperationReceiveMessageSaveReqSimpleVO reportReqVO) {
        return success(operationReceiveMessageService.report(reportReqVO));
    }

//    @PutMapping("/update")
//    @Operation(summary = "更新终端推送消息日志")
//    @PreAuthorize("@ss.hasPermission('ai:operation-receive-message:update')")
//    public CommonResult<Boolean> updateOperationReceiveMessage(@Valid @RequestBody OperationReceiveMessageSaveReqVO updateReqVO) {
//        operationReceiveMessageService.updateOperationReceiveMessage(updateReqVO);
//        return success(true);
//    }
//
//    @DeleteMapping("/delete")
//    @Operation(summary = "删除终端推送消息日志")
//    @Parameter(name = "id", description = "编号", required = true)
//    @PreAuthorize("@ss.hasPermission('ai:operation-receive-message:delete')")
//    public CommonResult<Boolean> deleteOperationReceiveMessage(@RequestParam("id") Long id) {
//        operationReceiveMessageService.deleteOperationReceiveMessage(id);
//        return success(true);
//    }
//
//    @GetMapping("/get")
//    @Operation(summary = "获得终端推送消息日志")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//    @PreAuthorize("@ss.hasPermission('ai:operation-receive-message:query')")
//    public CommonResult<OperationReceiveMessageRespVO> getOperationReceiveMessage(@RequestParam("id") Long id) {
//        OperationReceiveMessageDO operationReceiveMessage = operationReceiveMessageService.getOperationReceiveMessage(id);
//        return success(BeanUtils.toBean(operationReceiveMessage, OperationReceiveMessageRespVO.class));
//    }
//
//    @GetMapping("/page")
//    @Operation(summary = "获得终端推送消息日志分页")
//    @PreAuthorize("@ss.hasPermission('ai:operation-receive-message:query')")
//    public CommonResult<PageResult<OperationReceiveMessageRespVO>> getOperationReceiveMessagePage(@Valid OperationReceiveMessagePageReqVO pageReqVO) {
//        PageResult<OperationReceiveMessageDO> pageResult = operationReceiveMessageService.getOperationReceiveMessagePage(pageReqVO);
//        return success(BeanUtils.toBean(pageResult, OperationReceiveMessageRespVO.class));
//    }
//
//    @GetMapping("/export-excel")
//    @Operation(summary = "导出终端推送消息日志 Excel")
//    @PreAuthorize("@ss.hasPermission('ai:operation-receive-message:export')")
//    @ApiAccessLog(operateType = EXPORT)
//    public void exportOperationReceiveMessageExcel(@Valid OperationReceiveMessagePageReqVO pageReqVO,
//              HttpServletResponse response) throws IOException {
//        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
//        List<OperationReceiveMessageDO> list = operationReceiveMessageService.getOperationReceiveMessagePage(pageReqVO).getList();
//        // 导出 Excel
//        ExcelUtils.write(response, "终端推送消息日志.xls", "数据", OperationReceiveMessageRespVO.class,
//                        BeanUtils.toBean(list, OperationReceiveMessageRespVO.class));
//    }

}